package com.weixin.java8study;

import java.io.File;
import java.io.FileFilter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;

/**
 * @author lc
 * @email 389125111@qq.com
 * @create 2018-06-07 14:09
 */
public class Short {

    public static void main(String[] args) {

        List list = new ArrayList<Integer>() {{
            this.add(1);
            this.add(2);
            this.add(4);
            this.add(3);
            this.add(8);
        }};
        list.sort(Comparator.naturalOrder());
        System.err.println(list);

//        File[] hiddenfiles = new File(".").listFiles(File::isHidden);


        Short.getSomeThing(new ArrayList<Object>() {{
            this.add("12");
            this.add("1");
            this.add("1");
        }}, Object -> 1 == Object.toString().length());
    }


    public interface Test<T> {
        boolean test(T t);
    }

    public static <T> void getSomeThing(List<T> list, Test<T> a) {
        List<T> result = new ArrayList<>();
        for (T o : list) {
            if (a.test(o)) {
                result.add(o);
            }
        }
        System.out.println(result);
    }


}
